<?php



//echo 111;
//1.接受微信服务器上传的get参数
$signature = $_GET['signature'];
$timestamp = $_GET['timestamp'];
$nonce = $_GET['nonce'];
$echostr = $_GET['echostr'];
//2.接收前台提交的token值
$token = "hehe";
//3.将制定字符进行字典化排序
$arr = [$token,$timestamp,$nonce];
sort($arr);
//4.将三个数组切割成字符串进行sha1加密
$str  = implode($arr);
//file_put_contents('data.php',$str);
$string  =  sha1($str);
//file_put_contents('data.php',$string);
if ($string == $signature){

    echo $echostr;

}




?>